package com.itheima.staticfield;

public class Test {

    public static void main(String[] args) {

        //静态变量的访问：

        //1.类名.静态变量（推荐）
        Student.name = "张三";
        System.out.println(Student.name);

        //2.对象名.静态变量（不推荐）
        Student s = new Student();
        s.name = "李四";
        System.out.println(s.name);

        System.out.println(Student.name);

        System.out.println("=====");

        //实例对象的访问：

        //对象名.实例变量（唯一方式）
        Student s1 = new Student();
        s1.age = 18;
        System.out.println(s1.age);
        Student s2 = new Student();
        s2.age = 19;
        System.out.println(s2.age);

        //类名.实例变量（报错）

    }
}
